#ifndef __BOARD_COM_H
#define __BOARD_COM_H

#include "rttypes.h"
#ifdef __cplusplus
extern "C"{
#endif

#include <rtthread.h>
#include <rtdevice.h>
#include "can_common.h"
#include "robotdef.h"


#define GIMBAL_TAIL_CHECK_ID 0XAA
#define SHOOT_TAIL_CHECK_ID 0XBB
#define CHASSIS_TAIL_CHECK_ID 0XCC
#define SMALL_YAW_1_HEART_CHECK_ID 0XDD
#define SMALL_YAW_2_HEART_CHECK_ID 0XEE
#define CHASSIS_UPLOAD_DATA_CHECK_ID 0XFF

typedef struct
{
    CanMessage board_tx;
    #if defined(HERO_MODE) || defined(ENGINEER_MODE) || defined (INFANTRY_MODE)
    Chassis_Upload_Data_s Chassis_Upload_Data;
    #endif 

    #if defined(SENTRY_BOARD_CHASSIS)
    Chassis_Ctrl_Cmd_s Chassis_Ctrl_Cmd;
    #endif 

    #if defined(SENTRY_BOARD_BIG_YAW)
    Chassis_Upload_Data_s Chassis_Upload_Data;
    Small_Yaw_Heart_Pack_s Small_Yaw_Heart_Pack_1;
    Small_Yaw_Heart_Pack_s Small_Yaw_Heart_Pack_2;
    #endif 

    #if defined(SENTRY_BOARD_SMALL_YAW_2) || defined(SENTRY_BOARD_SMALL_YAW_1)
    Gimbal_Ctrl_Cmd_s Gimbal_Ctrl_Cmd;
    Shoot_Ctrl_Cmd_s Shoot_Ctrl_Cmd;
    #endif 

} board_com_s;

extern board_com_s board_com;

 
void board_send(rt_uint32_t target_id, void *data, rt_uint8_t checkid);
void *CANCommGet(rt_uint8_t checkid);
void board_recv(struct rt_can_msg rxmsg);

#ifdef __cplusplus
}
#endif

#endif // CAN_COMMON_H